package com.wuh.service.impl;

import com.wuh.mapper.ClassAttachmentMapper;
import com.wuh.model.ClassAttachment;
import com.wuh.service.ClassAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 公开课附件表(ClassAttachment)表服务实现类
 *
 * @author makejava
 * @since 2020-06-07 22:46:34
 */
@Service("classAttachmentService")
public class ClassAttachmentServiceImpl implements ClassAttachmentService {


    @Autowired
    private ClassAttachmentMapper attachmentMapper;


    /**
     * 通过实体作为筛选条件查询
     *
     * @param classAttachment 实例对象
     * @return 对象列表
     */
    @Override
    public List<ClassAttachment> findAttachmentAll(ClassAttachment classAttachment) {

        return attachmentMapper.findAttachmentAll(classAttachment);
    }

    /**
     * 添加文件
     *
     * @param classAttachment 实例对象
     * @return 影响行数
     */
    @Override
    public int addClassAttachment(ClassAttachment classAttachment) {
        return attachmentMapper.addClassAttachment(classAttachment);
    }

    /**
     * 根据公开课Id删除所属文件
     * @param classId
     * @return
     */
    @Override
    public int deleteById(Integer[] classId) {
        System.out.println("deleteById执行了");
        for (Integer integer : classId) {
            attachmentMapper.deleteById(integer);
        }
        return 0;
    }


}